import { Component, OnInit } from '@angular/core'
import { TranslateService } from '@ngx-translate/core'
import { homeBottomDataObject } from 'src/app/@core/auth-guard-service.guard'
import { DEFAULT_LANG, I18N_LANGUAGES } from 'src/config/language-config'

@Component({
  selector: 'app-footer',
  templateUrl: './footer.component.html',
  styleUrls: ['./footer.component.less']
})
export class FooterComponent implements OnInit {
  homeBottomDataList: homeBottomDataObject[]
  currentLang =
    localStorage.getItem('lang') ||
    window.navigator.language.toLowerCase() ||
    DEFAULT_LANG
  i18nValues: any //国际化变量

  constructor(private translate: TranslateService) {
    this.translate.addLangs(I18N_LANGUAGES)
    translate.setDefaultLang(DEFAULT_LANG)
    translate.use(this.currentLang)
  }

  ngOnInit(): void {
    this.i18nValues = this.translate.instant('pages')
    this.homeBottomDataList = [
      {
        linkList: [
          {
            url: 'https://www.huaweicloud.com/product/bcs/dac.html',
            name: this.i18nValues['link']['metaTown']
          }
        ],
        title: this.i18nValues['link']['productIntro']
      },
      {
        linkList: [
          {
            url: 'https://www.huaweicloud.com/consultation/index.html',
            name: this.i18nValues['link']['contextUs']
          }
        ],
        title: this.i18nValues['link']['help']
      }
    ]
  }
}
